import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDicServer extends UdpEchoServer{
    private Map<String,String> dict=new HashMap<>();

    public UdpDicServer(int port) throws SocketException {
        super(port);

        dict.put("dog","狗");
        dict.put("cat","猫");
        dict.put("pig","猪");
    }

    @Override
    public String process(String request){
        return dict.getOrDefault(request,"没有查到该单词");
    }

    public static void main(String[] args) throws IOException {
        UdpDicServer udpDicServer=new UdpDicServer(9090);
        udpDicServer.start();
    }
}

